<?php

class Model_DbTable_Criticise extends Zend_Db_Table
{

    protected $_name = 'criticise';

    protected $_rowClass = 'Model_Criticise';

	public function getAllByArtist($artistId) {
		$criticises = $this->fetchAll("artist={$artistId}");
		$this->injectReviewers($criticises);
		return $criticises;
	}
	
	private function injectReviewers(&$criticises) {
		$reviewerTable = new Model_DbTable_Reviewer();
		$map = $reviewerTable->getMap();
		foreach ($criticises as $criticise) {
			$criticise->reviewer = $map[$criticise->reviewer];
		}
	}
}

